<template>
    <div class="container">

        <el-carousel :interval="4000" type="card" height="400px">
            <el-carousel-item v-for="item in banner" :key="item.id">
                <img :src="item.path">
            </el-carousel-item>
        </el-carousel>

        <el-breadcrumb separator=">">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item><a href="/">活动管理</a></el-breadcrumb-item>
        </el-breadcrumb>

        <el-row :gutter="20">
            <el-col :span="6" v-for="item in summary" :key="item.id">
                <el-card :body-style="{ padding: '0px' }">
                    <router-link :to="{ path:'page' }"><img :src="item.path" class="image"></router-link>
                    <div class="clearfix">
                        <span>{{ item.title }}</span>
                        <div class="bottom">
                            <span>{{ item.created_at }}</span>
                            <span class="pull-right">{{ item.type }}</span>
                        </div>
                    </div>
                </el-card>
            </el-col>
        </el-row>

    </div>
</template>

<script>
    import Home from '@/services/home'
    export default {
        data () {
            return {
                activeName: 'first',
                banner: [],
                summary: [],
            }
        },
        mounted () {
            this.getBanner()
            this.getSummary()
        },
        methods: {
            getBanner() {
                Home.Banner().then(resp => {
                    this.banner = resp.data
                }).catch(err => {
                    console.error('>>>>> get vehicles-analysis error! the error is : ', err)
                })
            },

            getSummary() {
                Home.Summary().then(resp => {
                    this.summary = resp.data
                }).catch(err => {
                    console.error('>>>>> get vehicles-analysis error! the error is : ', err)
                })
            },
            handleClick(tab, event) {
                console.log(tab, event);
            }
        }
    }
</script>